﻿@{
    ViewBag.Title = ViewBag.Title + vngoodlife.Util.ConstantClass._suffixTitle;
}

<link href="../../../Content/tlcomment/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="@Url.Content("../../../Content/ckeditor/ckeditor.js")"></script>

    <div id="content">
        
        <div class="article">@{Html.RenderAction("MenuSiteMap", "MenuList", new { menuListID = ViewBag.ArticleTypeID });}
            @{  // Function chech user is admin or not
                    
                string[] roleList2 = vngoodlife.Util.ConstantClass.articleAuthentication.Split(',');
                foreach (string roleID in roleList2)
                {
                    if (Context.User.IsInRole(roleID))
                    {
                        <a href="@Url.Action("ArticleEdit", "Article", new { articleID = ViewBag.ArticleID })">
                            [edit]</a>
                       
                        break;
                    }
                }
            }
        </div>
        @*beging details article*@
           @{Html.RenderAction("BuildArticleContent", "Article", new { articleID = ViewBag.ArticleID });}
        @*end details article*@
        
        <div class="tlcomment">
            <section class="comments">

            @* 
                <article class="comment">
                    <a class="comment-img" href="#non">
                        <img src="http://lorempixum.com/50/50/people/1" alt="" width="50" height="50" />
                    </a> 
                    <div class="comment-body">
                    @{
                        string msg = "<p style='color:Lime;'>This is a new paragraph.</p>";
                        string msg1 = "<p style=\"color:Lime;\">This is a new paragraph.</p>";
                     }
                        <div class="text">
                            @Html.Raw(msg)
                        </div>
                        <p  class="attribution">bởi <a href="#non">Joe Bloggs</a> lúc 2:20 CH, 04/07/2012 
                           <a href="#" onclick="GetQuoting('@msg1');return false">Trích dẫn</a></p>
                        
                    </div>
                </article>
                 
               <article class="comment">
                    <a class="comment-img" href="#non">
                        <img src="http://lorempixum.com/50/50/people/7" alt="" width="50" height="50" />
                    </a>

                    <div class="comment-body">
                        <div class="text">
                            <p>This is a much longer one that will go on for a few lines.</p>
                            <p>It has multiple paragraphs and is full of waffle to pad out the comment. Usually, you just wish these 
                               sorts of comments would come to an end.It has multiple paragraphs and is full of waffle to pad out the 
                               comment. Usually, you just wish these sorts of comments would come to an end.It has multiple paragraphs 
                               and is full of waffle to pad out the comment. Usually, you just wish these sorts of comments would come 
                               to an end.</p>
                        </div>
                        <p class="attribution">bởi <a href="#non">Joe Bloggs</a> lúc 1:56 CH, 04/06/2012</p>
                    </div>
                </article>*@


                @{  // Function chech user is admin or not
                    bool checkRoleAdmin = false;
                    string[] roleList = vngoodlife.Util.ConstantClass.commentAuthentication.Split(',');
                    foreach (string roleID in roleList)
                    {
                        if (Context.User.IsInRole(roleID))
                        {
                            checkRoleAdmin = true;
                            break;
                        }
                    }
                  }


                @foreach (var item in ViewBag.CommentListOfArticle as IQueryable<vngoodlife.Comment>)
                {
                    <article class="comment">
                    @*For member comment*@
                    @if (item.CommentTypeID == 1)
                    {
                            <a class="comment-img" href="#non">
                            @if (item.Member.Avatar == null)
                            {
                                <img src="../../../Content/images/member/avatar_default.png" alt="" width="50" height="50" />
                            }
                            else
                            {
                                <img src="../../../Content/images/member/@item.Member.Avatar" alt="" width="50" height="50" />
                            }
                            </a> 
                            <div class="comment-body">
                                <div class="text">
                                    @Html.Raw(item.CommentContent)
                                </div>
                                <div  class="attribution">bởi <a href="#non">@item.MemberName</a> lúc @vngoodlife.Util.GeneralClass.ConvertDate_1D(item.CreateDate) 
                                   <a href="#" onclick="GetQuoting('@item.CommentContent');return false">Trích dẫn</a>
                                   
                                   @if (checkRoleAdmin)
                                   {
                                       @*<a href="@Url.Action("DeleteCommentOnFrontEnd", "Comment", new { commentID = item.CommentID, articleID = ViewBag.ArticleID })" 
                                    onclick="javascript: if (confirm('Bạn muốn xóa bình luận này?')) { window.location.href='#' } else { return false; };" style="color: Red; margin-left: 40px;" >
                                        Xóa</a>*@
                                   
                                       using (Html.BeginForm("DeleteCommentOnFrontEnd", "Comment", FormMethod.Post, new { style = "width: 50px;margin-left: 30px;display: inline;" }))
                                       {
                                            @Html.AntiForgeryToken(vngoodlife.Util.AntiKey.EditSalt)
                                            @Html.Hidden("commentID", item.CommentID)
                                            @Html.Hidden("articleSeoUrl", (string)ViewBag.ArticleSeoUrl)
                                            <input type="submit" value="Xóa" style="color: Red;"
                                            onclick="javascript: if (confirm('Bạn muốn xóa bình luận này?')) { window.location.href='#' } else { return false; };"/>
                                       }
                                   }
                                   </div>
                            </div>
                    }
                    
                    @*For Guest commnet*@
                    else
                    {
                            <a class="comment-img" href="#non">
                                <img src="../../../Content/images/member/avatar_default.png" alt="" width="50" height="50" />
                            </a> 
                            <div class="comment-body">
                                <div class="text">
                                    @Html.Raw(item.CommentContent)
                                </div>
                                <p  class="attribution">bởi <a href="#non">@item.GuestName</a> lúc @vngoodlife.Util.GeneralClass.ConvertDate_1D(item.CreateDate) 
                                   <a href="#" onclick="GetQuoting('@item.CommentContent');return false">Trích dẫn</a>
                                   @if (checkRoleAdmin)
                                   {
                                       using (Html.BeginForm("DeleteCommentOnFrontEnd", "Comment", FormMethod.Post, new { style = "width: 50px;margin-left: 30px;display: inline;" }))
                                       {
                                            @Html.AntiForgeryToken(vngoodlife.Util.AntiKey.EditSalt)
                                            @Html.Hidden("commentID", item.CommentID)
                                            @Html.Hidden("articleSeoUrl", (string)ViewBag.ArticleSeoUrl)
                                            <input type="submit" value="Xóa" style="color: Red;"
                                            onclick="javascript: if (confirm('Bạn muốn xóa bình luận này?')) { window.location.href='#' } else { return false; };"/>
                                       }

                                   }
                                   </p>
                                   
                            </div>
                    }
                        @*Delete comment for admin*@

                     </article>
                }
                
                <article class="comment">
                    <a class="comment-img" href="#non">
                        <img src="http://lorempixum.com/50/50/people/7" alt="" width="50" height="50"/>
                    </a>

                    <div class="comment-body">
                        <div class="text">

                     @{Html.RenderAction("CommentCreate", "Comment", new { articleID = ViewBag.ArticleID });}

                </article>
            </section>​

            <script src="../../../Scripts/Validation/CommentCreateValidation.js" type="text/javascript"></script>


          @*start comment zone *@
            @*<div class="commentarea" id="commentshow">
                <div class="formcomment">
                    <textarea id="txtaComment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
                    <a href="#lightboxlogin" title="Login Lightbox" class="button">Bình luận</a>
                    <input type='button' value='Làm lại' class="button"/> 
                </div>
                <script type="text/javascript">
                    CKEDITOR.replace('txtaComment', {
                        BasePath: '../../../Content/ckeditor/',
                        customConfig: 'CustomUser.js'
                    });
	            </script>*@
                @*end text comment*@

                @*formbox login*@
               @* <div class="guestmember">
                    <div class="lightbox" id="lightboxlogin">
			            <div class="w60p h400 scroll">
				            <h2>Your Content Goes Here!</h2>
				            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
				            <p>Sed dignissim viverra neque, sit amet lobortis elit luctus ac.</p>
				            <p>Proin a dignissim orci. Nam nec urna nisi, in blandit lorem. Nulla cursus ornare rhoncus.</p>
			            </div>
		                <p class="close"><a href="#" title="Close This Content Lightbox">Close <span>X</span></a></p>
		            </div>
                </div>*@
               @* end formbox login*@
            @*</div>*@
         @* end comment zone *@
         </div>
       
        
        <!--start paging-->
        <div id="container">
            <div class="pagination">
                @if (ViewBag.Previous_Mark_Visibility)
                {
		            <a href="@Url.RouteUrl("ArticleDetailFrontend", new { articleSeoUrl = ViewBag.ArticleSeoUrl, currentPage = 1 })" class="page gradient" 
                        title="Trang đầu">&laquo;</a>
                    <a href="@Url.RouteUrl("ArticleDetailFrontend", new { articleSeoUrl = ViewBag.ArticleSeoUrl, currentPage = ViewBag.PreviousPageIndex })" 
                        class="page gradient" title="Trang trước">&lsaquo;</a>
                }
                @for (int j = ViewBag.BeginPage; j <= ViewBag.EndPage; j++)
                {
                    if (j == ViewBag.CurrentPage)
                    {
                        <a href="@Url.RouteUrl("ArticleDetailFrontend", new { articleSeoUrl = ViewBag.ArticleSeoUrl, currentPage = j })" class="page active">@j</a> 
                    }
                    else
                    {
                        <a href="@Url.RouteUrl("ArticleDetailFrontend", new { articleSeoUrl = ViewBag.ArticleSeoUrl, currentPage = j })" class="page gradient">@j</a>
                    }
                }
                @if (ViewBag.Next_Mark_Visibility)
                {
                    <a href="@Url.RouteUrl("ArticleDetailFrontend", new { articleSeoUrl = ViewBag.ArticleSeoUrl, currentPage = ViewBag.NextPageIndex })" 
                        class="page gradient" title="Trang kế"> &rsaquo;</a>
                    <a href="@Url.RouteUrl("ArticleDetailFrontend", new { articleSeoUrl = ViewBag.ArticleSeoUrl, currentPage = ViewBag.LastPage })" 
                        class="page gradient" title="Trang cuối">&raquo;</a>
                }
	        </div>
        </div>
        <!--end paging-->

           @*begin othernews_label*@

        @*end othernews_label*@

         @*begin Other news - tin khác*@
           @{Html.RenderAction("GetOtherArticle", "Article", new { articleTypeID = ViewBag.ArticleTypeID, currentArticleID = ViewBag.ArticleID });}
         @*end Other news - tin khác*@
        
    </div>
    <!-- end #content -->
 @{
     string name = "eyeline_sharp_ads_big.jpg";
  }
 @section controlAds{
    <div style="width:100%;">
    <img src="../../../Content/Ads/@name" alt="" style="border:0; width:300px; height:auto;"/></div>
}
@section ExtraArticlecontrol{
    
    @{Html.RenderAction("GetArticle", "Article", new { flag = "2" });}
}


@section MetaTag{

    <meta name="description" content="@ViewBag.MetaDescription" />
    <meta name="keywords" content="@ViewBag.MetaTagList" />
    <meta content="http://vngoodlife.com/Content/images/article/thumbnail/@ViewBag.MetaArticleThumbnailUrl" itemprop="thumbnailUrl"  property="og:image" />	

}